package com.snopy.concurrency.demo_threadpool;

import lombok.extern.slf4j.Slf4j;

import java.sql.Time;
import java.util.concurrent.*;

/**
 * @author snopy
 * @version 1.0.0
 * @classname NewScheduledThreadPoolTest
 * @description
 * @email 77912204@qq.com
 * @date 2022/02/19 20:20
 */
@Slf4j
public class NewScheduledThreadPoolTest {
    static final ScheduledExecutorService es = Executors.newScheduledThreadPool(1);
    public static void main(String[] args) {

            es.schedule(new Runnable() {
                @Override
                public void run() {
                    log.info("干活~");
                }
            }, 3, TimeUnit.SECONDS);
            es.schedule(new Worker(), 3, TimeUnit.SECONDS);

    }
    static class Worker implements Callable<String>{

        @Override
        public String call() throws Exception {
            log.info("do do do");
            return "OK";
        }
    }
}
